package com.zmsk.zmio;

import android.content.Context;

import com.zmsk.zmio.constant.Const;
import com.zmsk.zmio.handler.CLHSHandler;
import com.zmsk.zmio.handler.GC082Handler;
import com.zmsk.zmio.handler.HuaChengHandler;
import com.zmsk.zmio.handler.S700Handler;
import com.zmsk.zmio.handler.Unwin328Handler;
import com.zmsk.zmio.handler.XJHHandler;
import com.zmsk.zmio.handler.YF021Hanlder;
import com.zmsk.zmio.handler.YSA80Handler;
import com.zmsk.zmio.handler.YSFace88Handler;
import com.zmsk.zmio.handler.YSLM8Handler;
import com.zmsk.zmio.handler.YSNM8Handler;
import com.zmsk.zmio.handler.YSPathHandler;
import com.zmsk.zmio.handler.YSOldHandler;
import com.zmsk.zmio.handler.YSV88Handler;
import com.zmsk.zmio.handler.YSWiegand;
import com.zmsk.zmio.handler.ZC83AHandler;
import com.zmsk.zmio.handler.ZCHandler;
import com.zmsk.zmio.inter.IIOHandler;

public class IOHandlerFactory {

    private static IIOHandler mIOHandler;

    private IOHandlerFactory () {

    }

    public static IIOHandler getInstance(Context context) {
        if (context == null) {
            return null;
        }
        if (mIOHandler == null) {
            switch (Const.CURRENT_IO) {
                case YS_FACE88:  mIOHandler = new YSFace88Handler(null);break;
                case YS_OLD: mIOHandler = new YSOldHandler(null); break;
                case ZC: mIOHandler = new ZCHandler(); break;
                case YS_PATH: mIOHandler = new YSPathHandler(); break;
                case YS_L_M8: mIOHandler = new YSLM8Handler(null); break;
                case YS_WIEGAND: mIOHandler = new YSWiegand(); break;
                case YS_A80: mIOHandler = new YSA80Handler(null); break;
                case YS_N_M8: mIOHandler = new YSNM8Handler(null); break;
                case CLHS: mIOHandler = new CLHSHandler(context); break;
                case XJH: mIOHandler = new XJHHandler(); break;
                case GC082: mIOHandler = new GC082Handler(); break;
                case S700: mIOHandler = new S700Handler(); break;
                case HUACHENG: mIOHandler = new HuaChengHandler(); break;
                case YS_V88: mIOHandler = new YSV88Handler(null); break;
                case ZX_M328: mIOHandler = new Unwin328Handler(); break;
                case ZC_83A: mIOHandler = new ZC83AHandler(); break;
                case YF_021H: mIOHandler = new YF021Hanlder(); break;
            }
        }
        return mIOHandler;
    }


}
